﻿@model ArivisAccounts.Models.EditUserModel

@{
    ViewBag.Title = "Edit User";
}

@using (Html.BeginForm("Edit", "User"))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Edit User Roles</legend>
        @Html.HiddenFor(model => model.User)
        <table class="editor-table">
            <tr>
                <td class="editor-label">
                    @Html.LabelFor(model => model.User)
                </td>
                <td class="editor-field">
                    @Html.DisplayFor(model => model.User)
                </td>
            </tr>
            <tr>
                <td class="editor-label">
                    @Html.LabelFor(model => model.RolesForUser)
                </td>
                <td class="editor-field">
                    @foreach (string role in Model.AllRoles)
                    {
                        <label>
                            @if (Model.RolesForUser.Contains(role))
                            {
                                <input type="checkbox" name="RolesForUser" value="@role" checked="checked" />
                            }
                            else
                            {
                                <input type="checkbox" name="RolesForUser" value="@role" />
                            }
                            @Html.Encode(role)
                        </label>
                    }
                </td>
            </tr>
        </table>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
